#include <iostream>
using namespace std;

class Student{
private:
    string id;
    string name;
    //成绩个数
    int scoreCount;
    //成绩数组
    double *scores;
public:
    Student(string id, string name, int scoreCount, double *scores){
        this->id = id;
        this->name = name;
        this->scoreCount = scoreCount;
        this->scores = scores;
    }
    ~Student(){
        delete []scores;
        cout<<"Student: "<<id<<" destroyed!"<<endl;
    }
    double getAverageSocre(){
        double sum=0;
        for(int i=0;i<scoreCount;i++){
            sum+=scores[i];
        }
        return sum/scoreCount;
    }
};

int main(){
    string id;
    string name;
    int scoreCount;
    cout<<"请输入学生学号："<<endl;
    cin>>id;
    cout<<"请输入学生姓名："<<endl;
    cin>>name;
    cout<<"请输入学生成绩个数："<<endl;
    cin>>scoreCount;
    double* scores=new double[scoreCount];
    cout<<"请输入学生成绩："<<endl;
    for(int i=0;i<scoreCount;i++){
        cout<<"请输入第"<<i+1<<"科成绩："<<endl;
        cin>>scores[i];
    }
    Student stu = Student(id,name,scoreCount,scores);
    cout<<"该名学生的平均成绩为："<<stu.getAverageSocre()<<endl;
    return 0;
}
